package Reader;

import java.io.*;

public class WriteDemo {
    public static void main(String[] args) throws IOException {
            FileReader reader = new FileReader("D:\\test\\b.txt");
            char [] buff= new char[20];
            int read;
            while ((read=reader.read())!=-1){
                System.out.println(new String(buff,0,read));
            }
            reader.close();
    }

    private static void text1() throws IOException {
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream("D:\\test\\b.txt", true));
        String str = "\n我今天学习了write";
        outputStreamWriter.write(str);
        outputStreamWriter.flush();
        outputStreamWriter.close();
    }
}
